package com.example.designpatterns.creational.abstractFactory;

import com.example.designpatterns.creational.factory.Circle;
import com.example.designpatterns.creational.factory.NoShape;
import com.example.designpatterns.creational.factory.Rectangle;
import com.example.designpatterns.creational.factory.Shape;
import com.example.designpatterns.creational.factory.Square;

/**
 * @author zuitu@foxmail.com
 * @date 2024/1/19
 */
public class ShapeFactory extends AbstractFactory {
    @Override
    public Shape getShape(String shape) {
        if(shape == null){
            return new NoShape();
        }
        if(shape.equalsIgnoreCase("CIRCLE")){
            return new Circle();
        } else if(shape.equalsIgnoreCase("RECTANGLE")){
            return new Rectangle();
        } else if(shape.equalsIgnoreCase("SQUARE")){
            return new Square();
        }
        return new NoShape();
    }
}
